package org.lanqiao.userprofile.movie.common;

import org.lanqiao.userprofile.movie.entity.DwdUserInfo;

import java.util.HashMap;
import java.util.Map;

public class CommonUtil {

    public static final HashMap<String, String> sexTag = new HashMap<String, String>() {{
        put("Romance", "female"); // female 甜宠、爱情
        put("Adventure", "male"); // male 冒险
    }};

    public static final HashMap<String, String> businessTag = new HashMap<String, String>() {{
        put("Sci-Fi", "互联网");
        put("History", "金融");
    }};

    public static String getTag(DwdUserInfo dwdUserInfo) {

        for (Map.Entry<String, String> entry : businessTag.entrySet()) {
            if (entry.getValue().equals(dwdUserInfo.getBusiness())) {
                return entry.getKey();
            }
        }

        for (Map.Entry<String, String> entry : sexTag.entrySet()) {
            if (entry.getValue().equals(dwdUserInfo.getSex())) {
                return entry.getKey();
            }
        }
        return "Action";
    }

    public static String getSex(String tag) {
        for (Map.Entry<String, String> entry : sexTag.entrySet()) {
            if (entry.getKey().equals(tag)) {
                return entry.getValue();
            }
        }
        return null;
    }

    public static String getBusiness(String tag) {
        for (Map.Entry<String, String> entry : businessTag.entrySet()) {
            if (entry.getKey().equals(tag)) {
                return entry.getValue();
            }
        }
        return null;
    }


}
